package cdworks.lifecounter;

import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

public class LCDbManager {
	
	private LCDbHelper sqlhelper = null;
	private SQLiteDatabase db = null;
	
	public LCDbManager(Context context){
		sqlhelper = new LCDbHelper(context);
		db = sqlhelper.getWritableDatabase();
	}
	
	
	public void putData(String type, double amount, String time, String sign)
	{
		ContentValues values = new ContentValues();
		//values.put(LCContract.LCEntry.COLUMN_NAME_ENTRY_ID, id);
		values.put(LCContract.LCEntry.COLUMN_NAME_TYPE, type);
		values.put(LCContract.LCEntry.COLUMN_NAME_AMOUNT, amount);
		values.put(LCContract.LCEntry.COLUMN_NAME_TIME, time);
		values.put(LCContract.LCEntry.COLUMN_NAME_SIGN, sign);
		
		// Insert the new row, returning the primary key value of the new row
		long newRowId;
		newRowId = db.insert(
		         LCContract.LCEntry.TABLE_NAME,
		         null,
		         values);
	}
	
	public void putTypeIn(String type)
	{
		ContentValues values = new ContentValues();
		//values.put(LCContract.LCEntry.COLUMN_NAME_ENTRY_ID, id);
		values.put(LCContract.LCInEntry.COLUMN_NAME_TYPE, type);

		
		// Insert the new row, returning the primary key value of the new row
		long newRowId;
		newRowId = db.insert(
		         LCContract.LCInEntry.TABLE_NAME,
		         null,
		         values);
	}
	
	public void readData()
	{
		
	}
	
	public SQLiteDatabase getDb()
	{
		return db;
	}

}
